<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>两新党组织基本信息</title>
<link href="/djzx/css/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/djzx/js/jquery-1.8.1.min.js"></script>
<script language="javascript" type="text/javascript" src="/djzx/js/My97DatePicker/WdatePicker.js"></script>
<script language="JavaScript" type="text/javascript" src="/djzx/js/backPage/clientSideApp.js"></script>
<script language="javascript">

$(document).ready(function(){
	$('#sex').val('${member.sex}');
	$('#generalPartyName').val("${lxGeneralParty.timeKey}");
	setPartyName();
	$('#partyName').val("${member.partyName}");
	$('#nationality').val('${member.nationality}');
	$('#degree').val('${member.degree}');
});

function goback(){
	var editFrom = ${editFrom };
	var timeKey = $('#timeKey').val();
	if(editFrom == 1){
		window.location.href="/djzx/LXMemberAction!getMemberInfoListForPage.action";
	}else if(editFrom == 2){
		window.location.href="/djzx/LXMemberAction!toShowMemberInfo.action?member.timeKey=" + timeKey;
	}else{
		
	}
}

function updateMember(){
	var timeKey = $.trim($('#timeKey').val());
	var name = $.trim($('#name').val());
	var sex = $.trim($('#sex').val());
	var nationality = $.trim($('#nationality').val());
	var nativePlace = $.trim($('#nativePlace').val());
	var born = $.trim($('#born').val());
	var degree = $.trim($('#degree').val());
	var workDate = $.trim($('#workDate').val());
	var partyName = $.trim($('#partyName').val());
	var memberType = $.trim($('#memberType').val());
	var joinDate = $.trim($('#joinDate').val());
	var confirmDate = $.trim($('#confirmDate').val());
	var title = $.trim($('#title').val());
	var note = $.trim($('#note').val());
	
	if(name==""){
		alert("姓名不能为空");
		return;
	}
	if(nationality==""){
		alert("民族不能为空");
		return;
	}
	/* if(nativePlace==""){
		alert("籍贯不能为空");
		return;
	} */
	
	var fd = new FormData();
	fd.append('member.timeKey',timeKey);
	fd.append('member.name',name);
	fd.append('member.sex',sex);
	fd.append('member.nationality',nationality);
	fd.append('member.nativePlace',nativePlace);
	fd.append('member.born',born);
	fd.append('member.degree',degree);
	fd.append('member.workDate',workDate);
	fd.append('member.partyName',partyName);
	fd.append('member.memberType',memberType);
	fd.append('member.joinDate',joinDate);
	fd.append('member.confirmDate',confirmDate);
	fd.append('member.title',title);
	fd.append('member.note',note);
	
	$.ajax({
	    url:"${pageContext.request.contextPath}/LXMemberAction!updateMemberInfo.action",
	    type:"POST",
	    data:fd,
	    dataType: "json", 
	    contentType: false, //必须
	    processData: false, //必须
	    success:function(data){
	    	alert(data.message);
			if(data.success){
				var editFrom = ${editFrom };
				var timeKey = $('#timeKey').val();
				if(editFrom == 1){
					window.location.href="/djzx/LXMemberAction!getMemberInfoListForPage.action";
				}else if(editFrom == 2){
					window.location.href="/djzx/LXMemberAction!toShowMemberInfo.action?member.timeKey=" + timeKey;
				}else{
					
				}
			}
	    }
	}); 
}

function setPartyName(){
	var options = "";
	
	$("#partyName2 option").each(function(){
        if($(this).val() == $('#generalPartyName').val()){
        	var option = '<option value="' + $(this).text() + '">' + $(this).text() + '</option>';
        	options += option;
        }
	});
	
	$('#partyName').html(options);
}

</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="25" align="center" valign="bottom" class="td06"><table width="98%" border="0" cellspacing="3" cellpadding="0">
      <tr>
        <td width="15"><img src="/djzx/images/index_32.gif" width="9" height="9"></td>
        <td valign="bottom" class="title">编辑党员</td>
      </tr>
    </table></td>
  </tr>
</table>
<br>
<input type="hidden" name="timeKey" id="timeKey" value="${member.timeKey }" />
<table align="center" width="95%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="90" height="24" class="td_form01">姓名</td>
        <td nowrap class=td_form02>
        	<input type="text" name="name" id="name" value="${member.name }" />
        </td>
        <td width="90" class="td_form01">性别</td>
        <td nowrap class=td_form02>
        	<select name="sex" id="sex">
              <option value="男">男</option>
			  <option value="女">女</option>
      		</select>
      	</td>
      </tr>
      <tr>
        <td height="24" class="td_form01">民族</td>
        <td nowrap class=td_form02>
        	<%-- <input type="text" name="nationality" id="nationality" value="${member.nationality }" /> --%>
        	<select name="nationality" id="nationality">
	        	<option value="汉族">汉族</option><option value="蒙古族">蒙古族</option><option value="回族">回族</option>
				<option value="藏族">藏族</option><option value="维吾尔族">维吾尔族</option><option value="苗族">苗族</option>
				<option value="彝族">彝族</option><option value="壮族">壮族</option><option value="布依族">布依族</option>
				<option value="朝鲜族">朝鲜族</option><option value="满族">满族</option><option value="侗族">侗族</option>
				<option value="瑶族">瑶族</option><option value="白族">白族</option><option value="土家族">土家族</option>
				<option value="哈尼族">哈尼族</option><option value="傣族">傣族</option><option value="黎族">黎族</option>
				<option value="傈傈族">傈傈族</option><option value="佤族">佤族</option><option value="畲族">畲族</option>
				<option value="高山族">高山族</option><option value="拉祜族">拉祜族</option><option value="水族">水族</option>
				<option value="东乡族">东乡族</option><option value="纳西族">纳西族</option><option value="景颇族">景颇族</option>
				<option value="柯尔克孜族">柯尔克孜族</option><option value="土族">土族</option><option value="达斡尔族">达斡尔族</option>
				<option value="仫佬族">仫佬族</option><option value="羌族">羌族</option><option value="布朗族">布朗族</option>
				<option value="撒拉族">撒拉族</option><option value="毛南族">毛南族</option><option value="仡佬族">仡佬族</option>
				<option value="锡伯族">锡伯族</option><option value="阿昌族">阿昌族</option><option value="普米族">普米族</option>
				<option value="塔吉克族">塔吉克族</option><option value="怒族">怒族</option><option value="乌孜别克族">乌孜别克族</option>
				<option value="俄罗斯族">俄罗斯族</option><option value="鄂温克族">鄂温克族</option><option value="德昂族">德昂族</option>
				<option value="保安族">保安族</option><option value="裕固族">裕固族</option><option value="京族">京族</option>
				<option value="塔塔尔族">塔塔尔族</option><option value="独龙族">独龙族</option><option value="鄂伦春族">鄂伦春族</option>
				<option value="赫哲族">赫哲族</option><option value="门巴族">门巴族</option><option value="珞巴族">珞巴族</option>
				<option value="基诺族">基诺族</option>
	        </select>
        </td>
        <td class="td_form01">籍贯</td>
        <td nowrap class=td_form02>
        	<input type="text" name="nativePlace" id="nativePlace" value="${member.nativePlace }" />
		</td>
      </tr>
	  <tr>
        <td height="24" class="td_form01">出生年月</td>
        <td nowrap class=td_form02>
        	<input type="text" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" name="born" id="born" value="${member.born }" readonly="readonly" />
			<img alt="" src="/djzx/images/datePicker.png">
		</td>
        <td class="td_form01">学历</td>
        <td nowrap class=td_form02>
        	<select name="degree" id="degree">
        	  <option value="0">小学</option>
        	  <option value="1">初中</option>
        	  <option value="2">技工学校</option>
        	  <option value="3">中等专科</option>
        	  <option value="4">普通高中</option>
        	  <option value="5">大专</option>
        	  <option value="6">大学</option>
        	  <option value="7">硕士研究生</option>
        	  <option value="8">博士研究生</option>
        	  <option value="-1">其他</option>
      	  	</select>
		</td>
      </tr>
	  <tr>
		<td class="td_form01">参加工作年月</td>
        <td nowrap class=td_form02>
        	<input type="text" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" name="workDate" id="workDate" value="${member.workDate }" readonly="readonly" />
			<img alt="" src="/djzx/images/datePicker.png">
		</td>
        <td height="24" class="td_form01">所属党组织名称</td>
        <td nowrap class=td_form02>
        	<%-- <select name="partyName" id="partyName">
        	  <s:iterator value="lxPartyList" var="lx" status="statu">
        	  	<option value="${lx.name }">${lx.name }</option>
        	  </s:iterator>
      		</select> --%>
      		<select name="generalPartyName" id="generalPartyName" onchange="setPartyName()">
        	  <s:iterator value="lxGeneralPartyList" var="c" status="statu">
        	  	<option value="${c.timeKey }">${c.name }</option>
        	  </s:iterator>
      	  	</select>
      	  	<br />
        	<select name="partyName" id="partyName">
        	  <s:iterator value="lxPartyList" var="c" status="statu">
        	  	<option value="${c.name }">${c.name }</option>
        	  </s:iterator>
      	  	</select>
        	<select name="partyName2" id="partyName2" style="display: none;">
        	  <s:iterator value="lxPartyList" var="c" status="statu">
        	  	<option value="${c.lxGeneralParty.timeKey }">${c.name }</option>
        	  </s:iterator>
      	  	</select>
      	</td>
      </tr>
	  <tr>
		<td class="td_form01">党员类型</td>
        <td nowrap class=td_form02>
        	<select name="memberType" id="memberType">
           	  <option value="正式党员">正式党员</option>
              <option value="预备党员">预备党员</option>
      		</select>
      	</td>
        <td height="24" class="td_form01">入党日期</td>
        <td nowrap class=td_form02>
        	<input type="text" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" name="joinDate" id="joinDate" value="${member.joinDate }" readonly="readonly" />
			<img alt="" src="/djzx/images/datePicker.png">
		</td>
      </tr>
	  <tr>
		<td height="24" class="td_form01">转正日期</td>
        <td nowrap class=td_form02>
        	<input type="text" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" name="confirmDate" id="confirmDate" value="${member.confirmDate }" readonly="readonly" />
			<img alt="" src="/djzx/images/datePicker.png">
		</td>
		<td class="td_form01">职务名称</td>
        <td nowrap class=td_form02>
        	<input type="text" name="title" id="title" value="${member.title }" />
		</td>
      </tr>
	  <tr>
		<td height="24" class="td_form01">备注</td>
        <td nowrap class=td_form02>
        	<input type="text" name="note" id="note" value="${member.note }" />
		</td>
      </tr>
</table>
<br>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center">
	    <input name="Submit2" type="button" class="buttonface" value="  保存  " onClick="updateMember()">
	    <input name="Submit" type="button" class="buttonface" value="  返回  "  onClick="goback()">
    </td>
  </tr>
</table>
<br>
</body>
</html>